﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.ModularFixture.CApMFGridRow
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using EMPMODELLib;
using EMPTYPELIBRARYLib;
using System.Drawing;
using Tecnomatix.Engineering;


namespace DnProcessSimulateCommands.ModularFixture;

internal abstract class CApMFGridRow
{
  protected int m_prototypeId;
  protected int m_instanceId;
  protected Image m_icon;
  protected int m_targetLibraryId;

  internal virtual int SaveNodeToEms(EmpObjectKey parent) => -1;

  protected virtual void SaveAttributes()
  {
  }

  protected virtual void LoadAttributes()
  {
  }

  protected void ValidateInternalIds()
  {
    EmpContext empContext;
    empContext.sessionId = TxApplication.ActiveDocument.eMSSessionId;
    EmpObjectClass empObjectClass = new EmpObjectClass();
    EmpObjectKey[] empObjectKeyArray = new EmpObjectKey[2];
    empObjectKeyArray[0].objectId = this.m_prototypeId;
    empObjectKeyArray[1].objectId = this.m_instanceId;
    bool[] flagArray = empObjectClass.DoObjectsExist(ref empContext, ref empObjectKeyArray);
    if (!flagArray[0])
      this.m_prototypeId = 0;
    if (flagArray[1])
      return;
    this.m_instanceId = 0;
  }

  internal virtual string Name
  {
    get => (string) null;
    set
    {
    }
  }

  internal virtual Image Icon => this.m_icon;

  internal virtual int PrototypeId => this.m_prototypeId;

  internal virtual int InstanceId
  {
    get => this.m_instanceId;
    set => this.m_instanceId = value;
  }

  internal int TargetLibraryId
  {
    get => this.m_targetLibraryId;
    set => this.m_targetLibraryId = value;
  }
}
